package stream.demo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author cyt
 * @create 2020-08-11 14:34
 */
public class Demo {

    public static void main(String[] args) {
        Stream<String> stream = Stream.of("a", "b", "c", "d");
        stream.forEach(System.out::println);
        /**
         * 数组中得到 stream 流
         */
        int[] ints = {1, 2, 3, 4, 5, 6, 6, 7};
        IntStream intStream = Arrays.stream(ints);

        ArrayList<Integer> list = new ArrayList<>();
        Stream<Integer> listStream = list.stream();

        System.out.println(intStream.filter(x -> x > 3).count());
        /**
         * 为了解决 基本数据类型到 包装类型的装箱拆箱，  引入了IntStream 等
         */
    }
}
